package xjtu.se.articlecommunity.user.myself.dao;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import xjtu.se.articlecommunity.user.myself.dto.FollowedUser;

import java.util.List;

public interface MyFollowDao {
    @Select("select fol.befollowed_u_id as u_id,users.u_name,users.u_avatar,users.u_mark from t_user users,t_follow fol where\n" +
            "fol.befollowed_u_id=users.u_id  and fol.u_id=#{u_id} and fol.ifchecked=1")
    List<FollowedUser> getInfoByU_id(String u_id);

    @Update("update t_follow set ifchecked=0 where u_id=#{u_id} and befollowed_u_id=#{befollowed_u_id}")
    void setIfCheckedByDto(String u_id,String befollowed_u_id);

    @Select("select fol.u_id,users.u_name,users.u_avatar,users.u_mark  from t_user users,\n" +
            "t_follow fol where fol.u_id=users.u_id and fol.befollowed_u_id=#{u_id} and fol.ifchecked=1")
    List<FollowedUser> getFansInfoByU_id(String u_id);
}
